/****************************************************************************//**
  \file uartSerializer.h

  \brief Declaration of uart serialize interface.

  \author
    Atmel Corporation: http://www.atmel.com \n
    Support email: avr@atmel.com

  Copyright (c) 2008-2013, Atmel Corporation. All rights reserved.
  Licensed under Atmel's Limited License Agreement (BitCloudTM).

  \internal
  History:
    30/03/09 A. Khromykh - Created
*******************************************************************************/
#ifndef _UARTSERIALIZER_H
#define _UARTSERIALIZER_H

#include <inttypes.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
/******************************************************************************
                   Define(s) section
******************************************************************************/
#ifndef INFINITE
  #define INFINITE true
#endif

// Baud rates 
#define BAUDRATE_9K6 207
#define BAUDRATE_19K2 103
#define BAUDRATE_38K4 51
#define BAUDRATE_57K6 34
#define BAUDRATE_115K2 16


/******************************************************************************
                   Prototypes section
******************************************************************************/
/**************************************************************************//**
\brief Uninit usart1
******************************************************************************/
void UART1_Uninit();

/**************************************************************************//**
\brief Startup initialization of the usart1
******************************************************************************/
void UART1_Init(uint16_t brgv);

/**************************************************************************//**
\brief UART1_SendByte
\ param uint_8 byte
\ return none
******************************************************************************/
void UART1_SendByte(uint8_t b);

/**************************************************************************//**
\brief UART1_SendData
\ param uint_8* ptr, uint_8 len
\ return none
******************************************************************************/
void UART1_SendData(uint8_t* ptr, uint8_t len);

/**************************************************************************//**
\brief UART1_SendString
\ param uint_8* address
\ return none
******************************************************************************/
void UART1_SendString(uint8_t* ptr);

/**************************************************************************//**
\brief UART1_SendDataPGM
\ param uint_32 address
\ return none
******************************************************************************/
void UART1_SendStringPGM(uint32_t address);

/**************************************************************************//**
\brief Receive byte on uart 1.

\param[out]
  p - pointer to byte memory;

\return
    true - there is received byte; \n
    false - there is not received byte;
******************************************************************************/
uint8_t UART1_GetByteNoWait(uint8_t *p);

/**************************************************************************//**
\brief Receive byte on uart 1, wait for received byte

\param[out]
  p - pointer to byte memory;

\return none
  
******************************************************************************/
void UART1_GetByteWait(uint8_t *p);


//void UART1_SendAck();
//void UART1_SendNack();

#endif //_UARTSERIALIZER_H
